﻿<div style="width: 100%; height: 100%">
    <div id="leftDiv" style="float: left; height: 97%; width: 54%;">
        <fieldset style="width: 100%; height: 100%; border: solid 1px #aaa; position: relative; padding: 5px; margin-bottom: 0px;">
            <legend><span style="font-size: 14px;">查询结果</span></legend>
            <div class="mini-toolbar" style="border-bottom: 0; padding: 0px; width: 100%;">
                <table style="width: 100%;">
                    <tr>
                        <td>
                            <input id="ddlSource" class="mini-combobox" style="width: 150px;" textfield="name" valuefield="code"
                                shownullitem="true" emptytext="-------------------------------" onvaluechanged="onKeyEnter" />
                            <span class="separator"></span>
                            <input id="keycode" class="mini-textbox" emptytext="输入子节点编码" style="width: 100px;" onenter="onKeyEnter" />
                            <span class="separator"></span>
                            <input id="keyvalue" class="mini-textbox" emptytext="输入子节点名称" style="width: 100px;" onenter="onKeyEnter" />
                            <span class="separator"></span>
                            <a class="mini-button" iconcls="icon-search" tooltip="搜索" plain="true" onclick="search()"></a>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="mini-fit">
                <div id="grid" class="mini-datagrid" style="width: 100%; height: 100%;" showemptytext="true" emptytext="无记录"
                    allowresize="false" pagesize="100" sizelist="[5,10,20,50,100]" allowcelledit="true" allowcellselect="true"
                    allowcellvalid="true" multiselect="true">
                    <div property="columns">
                        <div type="checkcolumn"></div>
                        <div field="DKey" width="120" headeralign="center" allowsort="true">子节点编码</div>
                        <div field="DValue" width="120" headeralign="center" allowsort="true">子节点名称</div>
                        <div field="DNote" width="120" headeralign="center" allowsort="true">备注</div>
                    </div>
                </div>
            </div>
        </fieldset>
    </div>
    <div style="float: left; width: 50px; height: 97%; margin-left: 15px; margin-right: 0px">
        <table style="width: 100%; height: 100%">
            <tr>
                <td align="center" style="vertical-align: middle">
                    <img src="~/Images/MoveImg/right-move.png" style="width: 24px; height: 24px;" onclick="add()" />
                    <p />
                    <img src="~/Images/MoveImg/left-move.png" style="width: 24px; height: 24px;" onclick="sub()" />
                </td>
            </tr>
        </table>
    </div>
    <div style="float: left; height: 97%; width: 38%">
        <fieldset style="width: 100%; height: 100%; border: solid 1px #aaa; position: relative; padding: 5px 5px 5px 5px; margin-bottom: 0px;">
            <legend><span style="font-size: 14px;">已选择子节点</span></legend>
            <div class="mini-toolbar" style="border-bottom: 0; padding: 0px;">
                <table style="width: 100%;">
                    <tr>
                        <td style="width: 100%; padding-left: 0px;">
                            <a class="mini-button" iconcls="icon-ok" style="width: 60px;" onclick="ok()" plain="true">确定</a>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="mini-fit">
                <div id="listbox" class="mini-listbox" showcheckbox="true" multiselect="true" style="width: 100%; height: 100%">
                    <div property="columns">
                        <div header="子节点编码" field="DKey" headeralign="center"></div>
                        <div header="子节点名称" field="DValue" headeralign="center"></div>
                    </div>
                </div>
            </div>
        </fieldset>
    </div>
</div>
<script type="text/javascript">
    mini.parse();

    var grid = mini.get("grid");
    grid.setUrl("/SystemData/HierarchyTree/GetAllHierarchyTreeLeaf");
    grid.load();

    var listbox = mini.get("listbox");

    function onKeyEnter() {
    }

    function search() {
        onKeyEnter();
    }

    function add() {
        var rows = grid.getSelecteds();
        listbox.addItems(rows);
    }

    function sub() {
        var rows = listbox.getSelecteds();
        listbox.removeItems(rows);
    }

    function ok() {
        var rows = listbox.getData();
        if (rows.length == 0) {
            top.mini.alert("请选择至少一条记录");
            return;
        } else {
            closeWindow("ok");
        }
    }

    function closeWindow(action) {
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }

    function getData() {
        var rows = listbox.getData();

        return rows;
    }

</script>
